package com.mfl.controller.user;

import com.mfl.common.PageResult;
import com.mfl.common.Result;
import com.mfl.pojo.dto.ExamDetailPageQueryDTO;
import com.mfl.pojo.dto.ExamPageQueryDTO;
import com.mfl.service.ExamDetailService;
import com.mfl.service.ExamService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController("userExamDetailController")
@RequestMapping("/cky/user/examDetail")
@Slf4j
public class ExamDetailController {

    @Autowired
    private ExamService examService;
    @Autowired
    private ExamDetailService examDetailService;

    /**
     * 分页查询考试记录
     * @param examPageQueryDTO
     * @return
     */
    @GetMapping("/page")
    public Result<PageResult> page(ExamPageQueryDTO examPageQueryDTO){
        log.info("分页查询用户考试记录：{}", examPageQueryDTO);
        PageResult pageResult = examService.pageQueryUserExamRecord(examPageQueryDTO);
        return Result.success("", pageResult);
    }

    /**
     * 分页查询考试记录详情
     * @param examDetailPageQueryDTO
     * @return
     */
    @GetMapping("/detail/page")
    public Result<PageResult> page(ExamDetailPageQueryDTO examDetailPageQueryDTO){
        log.info("分页查询考试记录详情：{}", examDetailPageQueryDTO);
        PageResult pageResult = examDetailService.pageQuery(examDetailPageQueryDTO);
        return Result.success("", pageResult);
    }
}
